package de.cbf.cam.dsa.services.impl.rcp_provider.factorys;

import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceRegistration;

import de.cbf.cam.dsa.services.impl.rcp_provider.ProviderProfession;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.RCPServiceImplExtensionPointResovler;
import de.cbf.cam.dsa.services.impl.rcp_provider.extension.interfaces.IRCPPersisterProfession;
import de.cbf.cam.dsa.services.interfaces.rcp_provider.IServiceDSAProviderProfession;

public class ServiceFactoryProviderProfessionDSA implements ServiceFactory<IServiceDSAProviderProfession> {

	public ServiceFactoryProviderProfessionDSA() {

	}

	@Override
	public IServiceDSAProviderProfession getService(Bundle bundle,
			ServiceRegistration<IServiceDSAProviderProfession> registration) {
		return getService();
	}

	@Override
	public void ungetService(Bundle bundle,
			ServiceRegistration<IServiceDSAProviderProfession> registration,
			IServiceDSAProviderProfession service) {

	}

	public IServiceDSAProviderProfession getService() {
		ProviderProfession provider = new ProviderProfession();
		IRCPPersisterProfession persister = RCPServiceImplExtensionPointResovler.getInstance().
			getPreferredProfessionPersister();
		provider.setPersister(persister);
		return provider;
	}

}
